package cn.cxyxj.code_auth_jwt_persistence_prod.common;

import lombok.Getter;

/**
 * Api接口响应枚举
 * @author: cxyxj
 * @create: 2022-01-17 14:00
 */
@Getter
public enum ApiResultEnum {
    /**
     * 错误产生来源分为 1/2/3
     * 1 表示错误来源于用户
     * 2 表示错误来源于当前系统
     * 3 表示错误来源于第三方服务
     */
    SUCCESS(0,"成功"),
    FAIL(1,"失败"),
    PARAM_ERROR(400,"参数异常"),
    METHOD_TYPE_ERROR(405,"方法请求类型错误"),

    //
    AUTH_ERROR(403,"无权限访问"),
    TOKEN_ERROR(403,"登录过期，请重写登录"),
    UNAUTHORIZED_ERROR(401,"您未登录，请先登录！"),
    // 用户业务状态码
    ACCOUNT_EXIST(10100,"账号已注册"),
    PHONE_EXIST(10101,"手机号已注册"),
    EMAIL_EXIST(10102,"邮箱已注册"),
    INFO_NOT_EXIST(10103,"该信息不存在哦"),

    ACCOUNT_FORMAT_ERROR(10103,"账号格式错误"),
    PHONE_FORMAT_ERROR(10104,"手机号格式错误"),
    EMAIL_FORMAT_ERROR(10105,"邮箱格式错误"),

    ROLE_NOT_EXIST(10106,"所选择的角色不存在"),
    PERMISSION_NOT_EXIST(10107,"所选择的数据权限不存在"),

    JSON_ERROR(10204,"JOSN格式异常"),
    PASSWORD_INCONSISTENCY(10205,"两次密码不一致，请重新输入"),
    // 系统业务状态码
    SAVE_ERROR(20701,"保存异常"),
    UPDATE_ERROR(20702,"修改异常"),
    DEL_ERROR(20703,"删除异常"),
    SYS_ERROR(29999,"系统异常"),
    ;

    private Integer code;

    private String msg;

    ApiResultEnum(Integer code, String msg){
        this.code = code;
        this.msg = msg;
    };
}
